import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/admin";

// 查询
export function listServer(query) {
  return request({
    url: '/server/page',
    method: 'post',
    data: query
  })
}

/**
 * 修改服务状态
 * @param {Object} id
 * @param {Object} status
 */
export function changeStatus(id,status) {
  let query ={
    "id":id,
    "serverStatus":status
  }
  return request({
    url: '/server/changeStatus',
    method: 'post',
    data: query
  })
}




/**
 * 新增服务
 * @param {Object} data
 */
export function addServer(data) {
  return request({
    url: '/server/saveTServer',
    method: 'post',
    data: data
  })
}

/**
 * 修改服务
 * @param {Object} data
 */
export function updateserver(data) {
  return request({
    url: '/server/updTServer',
    method: 'post',
    data: data
  })
}

/**
 * 删除服务
 * @param {Object} server
 */
export function delServer(server) {
  return request({
    url: '/server/removeServer?id='+server ,
    method: 'get'
  })
}

/**
 * 获取所有服务状态
 * @param {Object} server
 */
export function getServerStatus() {
  return request({
    url: '/server/queryAllStatus' ,
    method: 'get'
  })
}


export function listLogs(query) {
  return request({
    url: '/server/pageLog',
    method: 'post',
    data: query
  })
}